package com.mzy.linear_struct.ks.动规;

import java.util.Arrays;

/**
 * @Author: mizy3
 * @Date: 2024/08/22/上午11:31
 * @Description:
 */
public class 最长连续递增序列 {
    public int findLengthOfLCIS(int[] nums) {
        int[] dp = new int[nums.length];
        Arrays.fill(dp, 1);

        int ans = 1;
        for (int i = 1; i < nums.length; i++) {
            if (nums[i - 1] <= nums[i]) {
                dp[i] = dp[i - 1] + 1;
            }else {
                dp[i] = 1;
            }
            ans = Math.max(ans, dp[i]);
        }
        return ans;
    }

    public static void main(String[] args) {
        new 最长连续递增序列().findLengthOfLCIS(new int[]{1, 3, 5, 4, 7});
    }
}



















